<template>
	<view class="container">
			<view class="content">
				<view class="fridge">
					<view class="list_fridge" v-for="(item,index) in list" :key="index">
						<image src="@/static/images/fridge_bg.png"></image>
						<view class="list_content">
							<view class="list_header">
								<view class="list_sn">编号：{{item.sn}}</view>
								<view class="list_name">冰柜码：{{item.name?item.name:'暂未录入'}}</view>
							</view>
							<view class="list_info">
								<view class="list_date">绑定时间：{{item.create_time}}</view>
								<view class="list_title" v-if="item.expire_time">有效时间：{{item.expire_time}}</view>
							</view>
						</view>
					</view>
				</view>
				<loading-footer :status="loadingStatus" slotEmpty>
					<view class="data-null column-center" slot="empty">
						<image class="img-null" src="/static/images/order_null.png" />
						<text class="nr muted">暂无记录～</text>
					</view>
				</loading-footer>
			</view>
	</view>
</template>

<script>
	import {
		equipmentList
	} from '@/api/common.js';
	import {
		loadingType
	} from "@/utils/type";
	import {
		loadingFun
	} from "@/utils/tools"
	export default {
		data() {
			return {
				list: [],
				page: 1,
				loadingStatus: loadingType.LOADING
			}
		},
		onLoad() {
			this.equipmentFun()
		},
		onReachBottom() {
			this.equipmentFun()
		},
		methods: {
			equipmentFun() {
				let {
					list,
					loadingStatus,
					page
				} = this;
				loadingFun(equipmentList, page, list, loadingStatus).then(res => {
					if (res) {
						this.page = res.page;
						this.list = res.dataList;
						this.loadingStatus = res.status
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 40rpx 25rpx;
		
		.list_fridge {
			position: relative;
			margin-bottom: 20rpx;
			background: #FFFFFF;
			border-radius: 10rpx;
			height: 320rpx;

			image {
				width: 100%;
				height: 100%;
				border-radius: 10rpx;
			}

			.list_content {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				padding: 40rpx 20rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.list_header {
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 10rpx;
					.list_name {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 40rpx;
					}

					.list_sn {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 40rpx;
					}
				}

				.list_info {
					display: flex;
					flex-direction: column;
					justify-content: flex-end;
					align-items: flex-end;
					.list_date {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 40rpx;
					}

					.list_title {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 40rpx;
					}
				}
			}
		}
	}
</style>